import { Button } from 'antd';
import { PlusOutlined, DeleteOutlined } from '@ant-design/icons';

export default function ActionBar(props: any) {
    const { addLang, queryTableRef, selectedRowKeys, isForm, setSelectedRowKeys } = props;

    const onDelete = () => {
        if (selectedRowKeys?.length == 0) {
            return;
        };
        if (selectedRowKeys?.length > 0) {
            queryTableRef?.current?.onDelete(selectedRowKeys);
            setSelectedRowKeys([]);
        };
    };

    return (
        <div className='inbiz-lang-manage-right-actions-wrapper'>
            {
                !isForm
                &&
                <Button type='primary' icon={<PlusOutlined />} onClick={addLang}>新建多语言</Button>
            }
            <Button icon={<DeleteOutlined />} onClick={onDelete} disabled={!selectedRowKeys?.length}>删除</Button>
        </div>
    )
};